//==============================================================================
//	File:		$RCSfile: DataTypes.rdl,v $
//	Version:	$Revision: 1.3 $
//	Desc:		Data Types RDL Example
//	Author:		Greg Gibeling
//	Copyright:	Copyright 2005-2007 UC Berkeley
//
//	This copyright header must appear in all derivative works
//==============================================================================

//==============================================================================
//	Section:	License
//==============================================================================
// Copyright (c) 2005-2007, Regents of the University of California
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
//     - Redistributions of source code must retain the above copyright notice,
//         this list of conditions and the following disclaimer. 
//     - Redistributions in binary form must reproduce the above copyright
//         notice, this list of conditions and the following disclaimer
//         in the documentation and/or other materials provided with the
//         distribution. 
//     - Neither the name of the University of California, Berkeley nor the
//         names of its contributors may be used to endorse or promote
//         products derived from this software without specific prior
//         written permission. 
// 
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//==============================================================================

//==============================================================================
//	Section:	CVS Change Log
//==============================================================================
//	$Log: DataTypes.rdl,v $
//	Revision 1.3  2007/03/24 23:23:58  sshd_server
//	Fixed port struct example, added parameters to the example
//	
//	Revision 1.2  2007/02/27 02:10:58  sshd_server
//	Created RDL examples from RDLC2 test cases, FLEET and Overlog applications
//	
//==============================================================================

//------------------------------------------------------------------------------
//	Section:		Messages
//	Desc:			A series of message datatype declarations.  Note that later
//					code can refer to these types by name.  Not shown in this
//					example is the use of parameterized data type declarations,
//					which are entirely valid.
//					All of the declarations in this sections are for messages,
//					Which are carried indivisably by channels.  The structure
//					of messages effects both the marshaling of messages (and
//					thus the timing of their conveyance over channels) and their
//					packing and presentation to shell units.
//------------------------------------------------------------------------------
message event		MessageEvent;	// Carries no data
message bit<8>		MessageSimple;	// A byte
message bit<8>(3)	MessageArray;	// An array of 3 bytes, note that the array specifier for messages are ()
message munion {
	event FieldA<1>;
	bit<8> FieldB<2>;
}					MessageUnion1;	// Carries either an event or a 8bit value, using 1 and 2 as the tags
message munion {
	bit<7>(2) FieldA;
	bit<2> FieldB;
}					MessageUnion2;	// Carries one of two messages, assigning the tags automatically and passing them to the unit as parameters
message mstruct {
	bit<27> Address;
	bit<256> Data;
}					MessageStruct;	// A structured message with two fields.
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
//	Section:		Ports
//	Desc:			A series of port datatype declarations.  In contrast to the
//					above message declarations which add structure to messages
//					carried as indivisable units over channels these
//					declarations are declaring complex ports, which will require
//					separate channels, and may carry messages to separate
//					units.
//------------------------------------------------------------------------------
port MessageStruct[10] PortArray;	// An array of 10 ports, note that the array specifier for ports are []
port punion {
	covariant event			Field1<2>;
	contravariant bit<2>	Field2<3>;
}					PortUnionTagged;// A union of two ports, one or the other must be connected.  Notice
									// that this while port type declarations do not specify input or
									// output, a union can specify that some of it's fields are either co-
									// or contra-variant relative to whichever direction the actual port
									// instance is given when it's declared in the unit.
port <awidth = 27, dwidth = 256> pstruct {
	bit<$awidth>	Address;
	bit<$dwidth>	Data;
}					PortStruct;		// A structured port with two subports.  In contrast with the
									// MessageStruct type declared above, this is actually a declaration
									// of two separate ports, to which two channels must be connected.
									// In essence a port struct can be viewed as an "interface".
//------------------------------------------------------------------------------